package com.example.tamplate.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Data
@ApiModel(value = "壁纸")
public class Wallpaper {
    @TableId(type = IdType.AUTO)
    @ApiModelProperty("ID")
    private Integer id;

    @NotBlank(message = "图片地址不能为空")
    @ApiModelProperty(value = "图片地址")
    private String img;

    @ApiModelProperty(value = "分类ID")
    private Integer categoryid;

    @ApiModelProperty(value = "创建时间")
    private String createtime;

    @ApiModelProperty(value = "状态0隐藏1正常")
    private Integer status;

    // 构造函数，用于初始化创建时间
    public Wallpaper() {
        this.createtime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }
}
